<?php
global $Config;
require_once($Config->WebCMSRoot.'Base/View.php');

Class NavigationView extends BaseView
{
	function NavigationView()
	{
		parent::BaseView();
	}
	
	function PrintLeftMenu(&$navigation)
	{
		foreach($navigation->Collection as $key=>$nav)
		{
			$this->output .= '<div class="box current">';
			if (count($nav->Subnavigation) > 0)
			{
				$this->output .= '<h2><a href="' . $nav->Link . '">' . $nav->Titel . '</a></h2>';
				$this->output .= '<ul class="nav">';
				
				foreach ($nav->Subnavigation as $subkey=>$subnav)
				{
					$this->output .= '<li><a href="' . $subnav->Link . '">' . $subnav->Titel . '</a></li>';
				}
				
				$this->output .= '</ul>';
			}
			else
			{
				$this->output .= '<h3><a href="' . $nav->Link . '">' . $nav->Titel . '</a></h3>';
			}
			$this->output .= '</div>';
		}
	}
	
	function ClientSideTemplates()
	{
		$templates = array(
			'navigation' => array(
				'overview' => '<div class="overview_item">'.
							  '<div class="overviewTitle">[$Title$]</div>'.
							  '<div id="overviewDetails_[$ID$]" class="overviewDetails">[$Link$]<br />'.
				              '<div class="overview_actions">'.
							  '<a href="#" onClick="Navigation_Overview([$ID$])">Sub-Navigatie</a>'.
							  '<a href="#" onClick="Navigation_Edit_Item([$ID$])">Bewerken</a>'.
							  '<a href="#" onClick="confirm(\'Bent u zeker dat u \\\'[$Title$]\\\' wilt verwijderen?\', function() { Navigation_Delete_Item([$ID$]); } )">Verwijderen</a>'.
							  '</div>',
							  '</div>',
							  '</div>',
				'sortButton' => '<div class="overview_actions">'.
								'<span style="font-style: italic">(Sleep de items om de volgorde te bepalen)</span>'.
								'<a href="#" onClick="Navigation_SaveOrder()">Bewaar Volgorde</a>'.
								'</div>'/*,
				'edit' => '<div class="edit_item form">'.
						  '<div class="formFieldLabel"><label for="contentKey">Key:</label></div>'.
						  '<div class="formFieldEntry"><input type="text" value="[$Key$]" id="contentKey" name="contentkey" maxlength="100" size="50" /></div>'.
						  '<textarea id="contentHTML" name="contentHTML" class="fck" cols="50" rows="6">[$Content$]</textarea>'.
				          '<div class="overview_actions">'.
						  '<a href="#" onClick="Navigation_Overview()">Annuleren</a> '.
						  '<a href="#" onClick="Navigation_Save([$ID$])">Opslaan</a> '.
						  '<a href="#" onClick="confirm(\'Bent u zeker dat u \\\'[$Key$]\\\' \\n\\nwilt verwijderen?\', function() { Navigation_Delete_Item([$ID$]); } )" id="btnNavigation_Edit_Delete">Verwijderen</a> '.
						  '</div>',
						  '</div>',
				'photos' => '<div class="edit_item form">'.
						    '<h2>[$Title$]</h2>'.
						    '[$Description$]<br /><br />'.
						    '<div>{#template_koopje_images#}</div>'.
				            '<div class="overview_actions">'.
						    '<a href="#" onClick="Navigation_Overview()">Annuleren</a> '.
						    '<a href="#" onClick="Navigation_Photo_Add([$ID$], adminRoot + \'koopjes/imageUpload/[$ID$]\')">Toevoegen</a> '.
						    '</div>',
						    '</div>',
				'thumbnail' => '<div class="edit_thumbnail">'.
						  '<img s_rc="[$Thumbnail$]" alt="[$File$]" /><br />'.
						  '[$File$]'.
						  '</div>',
				'managephotos' => '<div class="edit_thumbnail">'.
						  '<img s_rc="[$Thumbnail$]" alt="[$File$]" /><br />'.
						  '[$File$]<br />'.
						  '<a href="#" class="button" onClick="confirm(\'Bent u zeker dat u deze foto wilt verwijderen?\', function() { Navigation_Photos_Delete([$ID$], [$_parentID$]); } )">Verwijder</a>'.
						  '</div>'*/
			)
		);
		$this->JsonOutput($templates);
	}
}
?>